package com.yl.ydk.ui.adapter

import com.yl.ydk.R
import com.yl.ydk.bean.HealthtestCategoryBean
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder

class HealthtestCategoryAdapter(data: MutableList<HealthtestCategoryBean.Data>?) :
    BaseQuickAdapter<HealthtestCategoryBean.Data, BaseViewHolder>(
        R.layout.item_healthy_category,
        data
    ) {


    override fun convert(helper: BaseViewHolder?, item: HealthtestCategoryBean.Data?) {

        helper?.let {
            it.setText(R.id.tvName, item?.title)
            it.itemView.setOnClickListener {
                onItemClick?.onListItemClick(item)
            }
        }
    }

    private var onItemClick: onListItemClick? = null

    interface onListItemClick {
        fun onListItemClick(item: HealthtestCategoryBean.Data?)
    }

    fun onListItemClick(onListItemClick: onListItemClick?) {
        this.onItemClick = onListItemClick
    }

}